﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Screen.Master" Inherits="System.Web.Mvc.ViewPage<IList<dbPoll_Application.Models.Participant>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Keypad Test
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">var webURL = false;</script>
    <script type="text/javascript" src="../../Scripts/PageControl.js"></script>
    <script type="text/javascript" src="../../Scripts/Screen-KeypadTest.js"></script>
    <div id="tileContainer">
    <%  var keypadUsers = Model.Where(m => m.type == dbPoll_Application.Models.ParticipantType.Keypad).ToList<dbPoll_Application.Models.Participant>();
        String className = String.Empty;
        int tilesPerRow = 0;
        if (keypadUsers.Count > 32)
        {
            className = "tile tile9x15";
            tilesPerRow = 9;
        }
        else {
            className = "tile tile4x8";
            tilesPerRow = 4;
        } %>
    <% for (int i = 0; i < keypadUsers.Count; i += tilesPerRow)
       { %>
       <div class="tileRow">
       <% for (int j = i; j < (i + tilesPerRow) && j < keypadUsers.Count; j++)
          {
              if (ViewData["show"] as String == "Name")
              { %>
           <span class="<%= className %>" id="keypad<%= keypadUsers[j].deviceID %>"><%= keypadUsers[j].firstName + " " + keypadUsers[j].lastName%></span>
           <% }
              else
              { %>
           <span class="<%= className %>" id="keypad<%= keypadUsers[j].deviceID %>"><%= keypadUsers[j].deviceID%></span>
           <% } %>
       <% } %>
       </div>
    <% } %>
        <input type="hidden" id="pollID" value="<%= ViewData["pollID"] %>" />
    </div>

</asp:Content>
